<?php if (isset($row) && !empty($row)): ?>

    <?php if(isset($edit) AND $edit): ?>
    <?php echo form_open('catalogue/edit/','',array('course_id' => $row->id)); ?>
    <table class="table table-condensed labels-centered" style="width:700px">
        <tr>
            <td>SchulungsID</td>
            <td><?php echo $row->id; ?></td>
        </tr>
        <tr>
            <td>Thema</td>
            <td><?php echo form_input('course', $row->title); ?></td>
        </tr>
        <tr>
            <td>Bereich(Kürzel)</td>
            <td><?php echo form_dropdown('faculty_id', $faculties);?></td>
        </tr>
        <tr>
            <td>Beschreibung</td>
            <td><?php echo form_textarea('description', $row->description); ?></td>
        </tr>
        <tr>
            <td>Preis</td>
            <td><?php $cost = $row->cost(); echo form_input('price', number_format($cost->amount, 2, ',', '.')); ?></td>
        </tr>
        <tr>
            <td>Telekom Training Code</td>
            <td><?php echo form_input('tt_code', $row->code); ?></td>
        </tr>
        <tr>
            <td>Telekom Training Link</td>
            <td><?php echo form_input('tt_link', $row->link); ?></td>
        </tr>
    </table>

    <?php echo anchor('/catalogue/details/'.$row->id, 'Abbrechen', 'class="btn"'); ?>&nbsp;
    <?php echo form_submit('save_changes', 'Änderungen übernehmen', 'class="btn btn-success"');?>
    <?php echo form_close(); ?>
    <?php else: ?>

    <table class="table table-condensed labels-centered" style="width:700px">
        <tr>
            <td>SchulungsID</td>
            <td><?php echo $row->id; ?></td>
        </tr>
        <tr>
            <td>Thema</td>
            <td><?php echo $row->title; ?></td>
        </tr>
        <tr>
            <td>Bereich(Kürzel)</td>
            <td><?php $faculty = $row->faculty(); echo $faculty->title . '(' . $faculty->code . ')'; ?></td>
        </tr>
        <tr>
            <td>Beschreibung</td>
            <td><?php echo $row->description; ?></td>
        </tr>
        <tr>
            <td>Preis</td>
            <td><?php $cost = $row->cost(); echo number_format($cost->amount, 2, ',', '.') . '€'; ?></td>
        </tr>
        <tr>
            <td>Telekom Training Code</td>
            <td><?php echo $row->code; ?></td>
        </tr>
        <tr>
            <td>Telekom Training Link</td>
            <td><?php if ($row->link) echo anchor_popup($row->link, $row->link); ?></td>
        </tr>
    </table>

        <?php if(isset($display_toolbar) AND $display_toolbar == TRUE): ?>
        <hr >
        <span>Funktionen</span>&nbsp;<a href="?mode=edit" class="btn btn-small" style="margin-left: 5px;"><i class="icon-pencil" style="margin-top:2px"></i> Schulung ändern</a>
        <?php endif; ?>
    <?php endif; ?>


<?php elseif (isset($error)): ?>
    <div class="alert alert-danger">
        <?php echo $error; ?>
    </div>
<?php endif; ?>